package com.luo.bbs.front.webapi.rabbitmq;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



@Configuration
public class RabbitMQConfig {
    public static final String COLLECT_EX = "collect_ex";
    public static final String COLLECT_ROUT1 = "collect_rout1";
    public static final String COLLECT_ROUT2 = "collect_rout2";
    public static final String COLLECT_QUEUE1 = "collect_queue1";
    public static final String COLLECT_QUEUE2 = "collect_queue2";

    @Bean
    public Queue collectQueue1(){
        return new Queue(COLLECT_QUEUE1);
    }

    @Bean
    public Queue collectQueue2(){
        return new Queue(COLLECT_QUEUE2);
    }

    @Bean
    public DirectExchange collectEX(){
        return new DirectExchange(COLLECT_EX);
    }
    @Bean
    public Binding collectBind1(){
        return BindingBuilder.bind(collectQueue1()).to(collectEX()).with(COLLECT_ROUT1);
    }
    @Bean
    public Binding collectBind2(){
        return BindingBuilder.bind(collectQueue2()).to(collectEX()).with(COLLECT_ROUT2);
    }


}
